#include <stdio.h>

int f(int n,int m)
{
    if(m==1||n==m)
        return 1;
    else
        return f(n-1,m-1)+f(n-1,m)*m;
}

int main(void)
{
    int n,m;
    while(scanf("%d%d",&n,&m)==2)
    {
        printf("%d\n",f(n,m));
    }
    return 0;
}